import React, { Component } from "react";

import { HashRouter as Router, Redirect, Route, Switch } from "react-router-dom";

import Address from "../Address/Address";
import Cart from "../Cart/Cart";
import Checkout from "../Checkout/Checkout";
import EditAddress from "../EditAddress/EditAddress";
import GoodsDetail from "../GoodsDetail/GoodsDetail";
import Index from "../Index/Index";
import Like from "../Like/Like";
import Login from "../Login/Login";
import My from "../My/My";
import Order from "../Order/Order";
import OrderDetail from "../OrderDetail/OrderDetail";
import Payment from "../Payment/Payment";
import Search from "../Search/Search";
import Set from "../Set/Set";
import SetAvatar from "../SetAvatar/SetAvatar";
import SetMobile from "../SetMobile/SetMobile";
import SetPassword from "../SetPassword/SetPassword";
import SetUserName from "../SetUserName/SetUerName";
import TabBar from "../TabBar/TabBar";
import Topic from "../Topic/Topic";

class PrivateRouter extends Component {
  render() {
    return (
      <Router>
        <Switch>
          <Route path="/address" exact render={(props) => <Address {...props}></Address>}></Route>
          <Route
            path="/cart"
            exact
            render={(props) => (
              <TabBar {...props}>
                <Cart></Cart>
              </TabBar>
            )}
          ></Route>
          <Route
            path="/checkout"
            exact
            render={(props) => (
              <TabBar {...props}>
                <Checkout></Checkout>
              </TabBar>
            )}
          ></Route>
          <Route
            path="/editorAddress"
            exact
            render={(props) => <EditAddress {...props}></EditAddress>}
          ></Route>
          <Route
            path="/goodsDetail"
            exact
            render={(props) => <GoodsDetail {...props}></GoodsDetail>}
          ></Route>
          <Route
            path="/index"
            exact
            render={(props) => (
              <TabBar {...props}>
                <Index></Index>
              </TabBar>
            )}
          ></Route>
          <Route path="/like" exact render={(props) => <Like {...props}></Like>}></Route>
          <Route
            path="/login"
            exact
            render={(props) => (
              <TabBar {...props}>
                <Login></Login>
              </TabBar>
            )}
          ></Route>
          <Route
            path="/my"
            exact
            render={(props) => (
              <TabBar {...props}>
                <My></My>
              </TabBar>
            )}
          ></Route>
          <Route
            path="/order"
            exact
            render={(props) => (
              <TabBar {...props}>
                <Order></Order>
              </TabBar>
            )}
          ></Route>
          <Route
            path="/orderDetail"
            exact
            render={(props) => <TabBar {...props}><OrderDetail></OrderDetail></TabBar>}
          ></Route>
          <Route path="/payment" exact render={(props) => <Payment {...props}></Payment>}></Route>
          <Route
            path="/search"
            exact
            render={(props) => (
              <TabBar {...props}>
                <Search></Search>
              </TabBar>
            )}
          ></Route>
          <Route path="/set" exact render={(props) => <Set></Set>}></Route>
          <Route
            path="/setAvatar"
            exact
            render={(props) => <SetAvatar {...props}></SetAvatar>}
          ></Route>
          <Route
            path="/setMobile"
            exact
            render={(props) => <SetMobile {...props}></SetMobile>}
          ></Route>
          <Route
            path="/setPassword"
            exact
            render={(props) => <SetPassword {...props}></SetPassword>}
          ></Route>
          <Route
            path="/setUserName"
            exact
            render={(props) => <SetUserName></SetUserName>}
          ></Route>
          <Route
            path="/topic"
            exact
            render={(props) => (
              <TabBar {...props}>
                <Topic></Topic>
              </TabBar>
            )}
          ></Route>
          <Redirect to="/index"></Redirect>
        </Switch>
      </Router>
    );
  }
}
export default PrivateRouter;
